<template>
	<view class="">
		<view class="kxzczxert pd">
			<view class="display-flex cxvcxvrtret" @tap="hf('userInfo')">
				<view class="">

					<image :src="ret.headUrl" class="ucxcxrtreyt" v-if="ret.headUrl"></image>
					<image src="../../static/img/userimg.png" class="ucxcxrtreyt" v-else></image>
				</view>
				<view class="ml20 vertical-center tl flex-1">
					<view class="">
						<view class="fz36 cf">
							{{ret.name||'微信用户'}}
						</view>
						<view class="fz24 cf mt10">
							薪智直聘 天天发薪
						</view>
					</view>
				</view>
			<!-- 	<view class="vertical-center">
					<icon class="iconfont icon-saoma cf fz50 cz" @tap.stop="skkfd"></icon>
				</view> -->
			</view>
			<view class="mt20" v-if="!ret.isAuthentication" @tap="hf('realNameAuthentication')">
				<image src="../../static/img/cxzcfd2.png" class="w100 dsfdczxrtt"></image>
			</view>
		</view>

		<view class="mt20 pd">
			<view class="kxczxcstreszxr pd pt30 pm30">
				<view class="fz32 display-flex pr">
					<view class="flex-1">
						<text class="kkxczxerwt">我的余额</text>
					</view>
					<icon class=" iconfont icon-yanjing_xianshi cz dfsdxcfstr z9" v-if="ixsr" @tap="ixsr=false"></icon>
					<icon class=" iconfont icon-yanjing_yincang cz dfsdxcfstr z9" v-else @tap="ixsr=true"></icon>
				</view>
				<view class="display-flex">
					<view class="mt30 fz50 b flex-1 vertical-center tl">
						<text v-if="ixsr">{{ret.balance}}</text>
						<text v-else>****</text>
					</view>
					<view class="vertical-bottom ">
						<view class="bkxczr ab dfdcxzret" @tap="kxxzcfdfrt('purse')">
							<text class="">提现</text>
							<icon class="iconfont icon-rightyou cz "></icon>
						</view>
					</view>
				</view>
			</view>
		</view>

		<view class="mt20 pd">
			<view class="kxczxcstreszxr pd pt30 pm30">
				<view class="fz32 display-flex pr">
					<view class="flex-1">
						<text class="kkxczxerwt">我的服务</text>
					</view>
				</view>
				<view class="btm mt20 pt20 jxzczxefxcer">

					<view class="cen" @tap="hf('perfectTheInformation')">
						<view class="xcxzcvgrxc vertical-center">
							<icon class="iconfont icon-wanshanziliao ls fz50"></icon>
						</view>
						<view class="fz24 z9">
							完善资料
						</view>
					</view>
					<view class="cen" @tap="hf('realNameAuthentication')">
						<view class="xcxzcvgrxc vertical-center">
							<icon class="iconfont icon-dingdangdaishimingrenzheng ls fz60"></icon>
						</view>
						<view class="fz24 z9">
							实名认证
						</view>
					</view>
				<!-- 	<view class="cen" @tap="hf('posterCampaign')">
						<view class="xcxzcvgrxc vertical-center">
							<icon class="iconfont icon-yingxiaogongju-shoujihaibao ls fz60"></icon>
						</view>
						<view class="fz24 z9">
							宣传海报
						</view>
					</view> -->
					<view class="cen" @tap="kxxzcfdfrt('emergencyContact')">
						<view class="xcxzcvgrxc vertical-center">
							<icon class="iconfont icon--jinjilianxiren red fz60"></icon>
						</view>
						<view class="fz24 z9">
							紧急联系人
						</view>
					</view>

					<view class="cen" @tap="kxxzcfdfrt('myRegistration')">
						<view class="xcxzcvgrxc vertical-center">
							<icon class="iconfont icon-wodebaoming ls fz50"></icon>
						</view>
						<view class="fz24 z9">
							我的报名
						</view>
					</view>
					<view class="cen" @tap="kxxzcfdfrt('billingDetails')">
						<view class="xcxzcvgrxc vertical-center">
							<icon class="iconfont icon-zhangdanmingxi ls fz50"></icon>
						</view>
						<view class="fz24 z9">
							账单明细
						</view>
					</view>
					<view class="cen" @tap="kxxzcfdfrt('payCardList')">
						<view class="xcxzcvgrxc vertical-center">
							<icon class="iconfont icon-congyerenyuangongzizonge ls fz50"></icon>
						</view>
						<view class="fz24 z9">
							发薪卡
						</view>
					</view>
					<view class="cen" @tap="kxxzcfdfrt('salarySheet')">
						<view class="xcxzcvgrxc vertical-center">
							<icon class="iconfont icon-gongzitiao ls fz60"></icon>
						</view>
						<view class="fz24 z9">
							工资条
						</view>
					</view>
					<view class="cen" @tap="kxxzcfdfrt('advancePayroll')">
						<view class="xcxzcvgrxc vertical-center">
							<icon class="iconfont icon-feiyongyuzhi ls fz50"></icon>
						</view>
						<view class="fz24 z9">
							预支薪资
						</view>
					</view>
			<!-- 		<view class="cen" @tap="kxxzcfdfrt('dormitoryService')">
						<view class="xcxzcvgrxc vertical-center">
							<icon class="iconfont icon-susheguanli ls fz50"></icon>
						</view>
						<view class="fz24 z9">
							宿舍服务
						</view>
					</view> -->
					<view class="cen" @tap="kzxerfew">
						<view class="xcxzcvgrxc vertical-center">
							<icon class="iconfont icon-lizhizhengming ls fz50"></icon>
						</view>
						<view class="fz24 z9">
							离职报备
						</view>
					</view>
					<view class="cen" @tap="kxxzcfdfrt('feedback')">
						<view class="xcxzcvgrxc vertical-center">
							<icon class="iconfont icon-yijianfankui ls fz60"></icon>
						</view>
						<view class="fz24 z9">
							意见反馈
						</view>
					</view>
					<view class="cen" @tap="kxxzcfdfrt('contractManagement')">
						<view class="xcxzcvgrxc vertical-center">
							<icon class="iconfont icon-hetongguanli ls fz60"></icon>
						</view>
						<view class="fz24 z9">
							合同管理
						</view>
					</view>
				</view>
			</view>
		</view>

	<!-- 	<view class="pd pm100 mt40" @tap="jmxcxdfr">
			<button type="warn" class="mt20">退出登录</button>
		</view> -->
	</view>
</template>
<script lang="ts" setup>
	import { ref } from "vue"
	import { hf, hfer, hfsan, dxrequest, VerifyTheLogin } from "@/util/index.js"
	import { onShow } from "@dcloudio/uni-app"
	const ret = ref({})
	const imxdr = ref(false)
	const getuser = async () => {
		const openid = uni.getStorageSync("openid")
		const { data } = await dxrequest("/api/user/" + openid)
		if (!data.headUrl && !imxdr.value) {
			uni.showModal({
				title: "温馨提示",
				content: "为了给您提供更好的服务，请设置您的头像、昵称信息",
				cancelText: "稍后设置",
				confirmText: "立即设置",
				success({ confirm }) {
					if (confirm) {
						hf("userInfo")
					} else {
						imxdr.value = true
					}
				}
			})
		}
		ret.value = data

	}


	onShow(() => {
		VerifyTheLogin()
		getuser()
	})
	const ixsr = ref()
	const skkfd = () => {
		uni.scanCode({
			success: function (res) {
				console.log('条码类型：' + res.scanType);
				console.log('条码内容：' + res.result);
			}
		});
	}
	const kzxerfew = async()=>{
		if(!ret.value.isJob){
			uni.showToast({
				icon: "none",
				title: "您还未入职"
			})
			return
		} 
		hf('/pages/userCenter/lizhisq')
	}
	const kkcdf = (text) => {
		let kmxcr = text
		if (!text) {
			kmxcr = "正在开发中..."
		}
		uni.showToast({
			icon: "none",
			title: kmxcr
		})
	}
	const jmxcxdfr =()=>{
		try {
			uni.clearStorageSync();
		} catch (e) {
			// error
		}
		uni.switchTab({
			url: '/pages/index/index'
		});
	}
	const kxxzcfdfrt = (url) =>{
		if(!ret.value.isAuthentication){
			uni.showModal({
				title: "温馨提示",
				content: "根据要求,请进行实名认证",
				cancelText: "稍后认证",
				confirmText: "立即认证",
				success({ confirm }) {
					if (confirm) {
						hf("realNameAuthentication")
					}
				}
			})
			return
		}
		hf(url)
	}
</script>

<style scoped>
	
</style>